package com.hk.core.jdbc.query;

/**
 * 查询条件参数化
 *
 * @author Kevin
 * @date 2022-11-21 23:29
 */
public enum Parametric {

    /**
     * a = ?
     */
    PARAMETERIZATION() {
        @Override
        public String parametric(String name, int index) {
            return "?";
        }
    },

    /**
     * a = :a
     */
    NAMED() {
        @Override
        public String parametric(String name, int index) {
            return STR.":\{name}";
        }
    },

    /**
     * a = ?1
     */
    PARAMETERIZATION_INDEX() {
        @Override
        public String parametric(String name, int index) {
            return STR."?\{index}";
        }
    },

    /**
     * a = $1
     */
    DOLLAR_INDEX() {
        @Override
        public String parametric(String name, int index) {
            return STR."$\{index}";
        }
    };

    public abstract String parametric(String name, int index);
}
